function WStest(name)
{
    //alert("WStest");

	var parameters = '{"value":"'+document.getElementById('test_name').value+'"}';

	$.ajax({
	      url: "/ACBServiceProxy.svc/GetTestStringLocal",
          type: 'POST',
          async: false,
          dataType: 'json',
          contentType: 'application/json; charset="utf-8"',
          data: parameters,
          complete: function(response) {
               alert('complete: response '+response+' responseText '+response.responseText);

          },
          error: function(response) {
               alert('error '+response.responseText);
          }

    });

    //alert("WStest done");

	return true;
}

function WStest2(name) {
    //alert("WStest");

    var parameters = '{"value":"' + document.getElementById('test_name').value + '"}';

    $.ajax({
        url: "/ACBServiceProxy.svc/GetTestStringRemote",
        type: 'POST',
        async: false,
        dataType: 'json',
        contentType: 'application/json; charset="utf-8"',
        data: parameters,
        complete: function (response) {
            alert('complete: response ' + response + ' responseText ' + response.responseText);

        },
        error: function (response) {
            alert('error ' + response.responseText);
        }

    });

    //alert("WStest done");

    return true;
}

function ValidateAccount() {
    //alert("WStest");


    var parameters = '{"bankId":"' + document.getElementById('bankId').value
                    + '","branchId":"' + document.getElementById('branchId').value
                    + '","accountTypeId":"' + document.getElementById('accountTypeId').value
                    + '","account":"' + document.getElementById('account').value                    
                    + '"}';

    $.ajax({
        url: "/ACBServiceProxy.svc/ValidateAccount",
        type: 'POST',
        async: false,
        dataType: 'json',
        contentType: 'application/json; charset="utf-8"',
        data: parameters,
        complete: function (response) {
            alert('complete: response ' + response + ' responseText ' + response.responseText);
            var res = jQuery.parseJSON(response.responseText);
            document.getElementById("errNum").value = res.ValidateAccountResult;
        },
        error: function (response) {
            alert('error ' + response.responseText);
        }

    });

    //alert("WStest done");

    return true;
}


function ErrDescriptionString() {
    //alert("WStest");


    var parameters = '{"errCode":"' + document.getElementById('errNum').value
                    + '"}';

    $.ajax({
        url: "/ACBServiceProxy.svc/ErrDescriptionString",
        type: 'POST',
        async: false,
        dataType: 'json',
        contentType: 'application/json; charset="utf-8"',
        data: parameters,
        complete: function (response) {
            alert('complete: response ' + response + ' responseText ' + response.responseText);
            var res = jQuery.parseJSON(response.responseText);
            document.getElementById("errNumDesc").value = res.ErrDescriptionStringResult;
        },
        error: function (response) {
            alert('error ' + response.responseText);
        }

    });

    //alert("WStest done");

    return true;
}

/*
function AccNoValidator(AccountNo,AccountType,BankName,BranchName,BranchCode)
{
	var parameters = "{'AccountNo':'"+AccountNo+"',"+	
					"'AccountType':'"+AccountType+"',"+	
					"'BankName':'"+BankName+"',"+	
					"'BranchName':'"+BranchName+"',"+	
					"'BranchCode':'"+BranchCode+"'}";

	$.ajax({
          url: "/Quantum/Service1.asmx/ACBCheck",
          type: 'POST',
          async: false,
          dataType: 'json',
          contentType: 'application/json; charset="utf-8"',
          data: parameters,
          complete: function(response) {
               //alert('complete'+response.responseText);
			   var res = jQuery.parseJSON(response.responseText);
			   alert(res.d);
			   if (res.d != 'Ok') EFormSetFocus(EFormGetField("PDBank"));
				
          },
          error: function(response) {
               alert('error'+response.responseText);
          }

    });

	return true;
}
*/

function GetBanks() {
    var parameters = '{ }';

    $.ajax({
        url: "/ACBServiceProxy.svc/GetBanks",
        type: 'POST',
        async: false,
        dataType: 'json',
        contentType: 'application/json; charset="utf-8"',
        data: parameters,
        complete: function (response) {
            alert('complete: response ' + response + ' responseText ' + response.responseText);
            var res = jQuery.parseJSON(response.responseText);
            document.getElementById("banks").value = res.GetBanksResult;
        },
        error: function (response) {
            alert('error ' + response.responseText);
        }
    });
}



function GetBank() {
    var parameters = '{"bankCode":"' + document.getElementById('bankCode2').value
                    + '"}';

    $.ajax({
        url: "/ACBServiceProxy.svc/GetBank",
        type: 'POST',
        async: false,
        dataType: 'json',
        contentType: 'application/json; charset="utf-8"',
        data: parameters,
        complete: function (response) {
            alert('complete: response ' + response + ' responseText ' + response.responseText);
            var res = jQuery.parseJSON(response.responseText);
            document.getElementById("bank2").value = res.GetBankResult;
        },
        error: function (response) {
            alert('error ' + response.responseText);
        }
    });
}


function GetBranches() {
    var parameters = '{"bankCode":"' + document.getElementById('bankCode3').value
                    + '"}';
    $.ajax({
        url: "/ACBServiceProxy.svc/GetBranches",
        type: 'POST',
        async: false,
        dataType: 'json',
        contentType: 'application/json; charset="utf-8"',
        data: parameters,
        complete: function (response) {
            alert('complete: response ' + response + ' responseText ' + response.responseText);
            var res = jQuery.parseJSON(response.responseText);
            document.getElementById("branches").value = res.GetBranchesResult;
        },
        error: function (response) {
            alert('error ' + response.responseText);
        }
    });
}